package Tree;

import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-07-18
 * Time: 15:28
 */
public class TreeTest {
    public static void main(String[] args) {

        BinaryTree binaryTree = new BinaryTree();
        String str = "abc##de#g##f###";
        BinaryTree.TreeNode root = BinaryTree.createTree(str);

        System.out.println("========前序遍历========");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("========前序遍历(非递归)========");


        // 前序遍历（非递归实现）
        binaryTree.preOrderNor(root);
        System.out.println();

        System.out.println("========中序遍历========");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.println("========中序遍历(非递归)========");


        // 中序遍历（非递归实现）
        binaryTree.inOrderNor(root);
        System.out.println();


        System.out.println("========后序遍历========");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("========后序遍历(非递归)========");

        binaryTree.postOrderNor(root);
        System.out.println();



        /*binaryTree.size(root);
        System.out.println("二叉树长度 " + BinaryTree.nodeSize);*/


//        System.out.println("二叉树长度 " + binaryTree.size2(root));

        binaryTree.getLeafNodeCount(root);
        System.out.println("二叉树叶子节点个数 " + BinaryTree.NodeCount);


        System.out.println("二叉树叶子节点个数 " + binaryTree.getLeafNodeCount2(root));
        System.out.println();

        System.out.println("二叉树第K层节点个数 " + binaryTree.getKLeveNodeCount(root,4));
        System.out.println();

        System.out.println("二叉树的高度 " + binaryTree.getHeight(root));
        System.out.println();

        System.out.println(binaryTree.levelOrder2(root));



        System.out.println(binaryTree.isCompleteTree(root));



    }
}
